﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CNKI.TPI.Web.Interface.Models
{
    public enum Status
    {
        Success,
        Error,
        AuthenticationFailed,
        InvalidSessionID,
    };
    public class OutputEntity
    {
        private Status status;

        public Status Status
        {
            get { return status; }
            set
            {
                status = value;
                message = getMessage(value);
            }
        }

        public string message { set; get; }
        public object data { set; get; }
        private string getMessage(Status status)
        {
            string result = "";
            switch (status)
            {
                case Status.Success:
                    result = "success";
                    break;
                case Status.Error:
                    result = "error";
                    break;
                case Status.AuthenticationFailed:
                    result = "authentication failed";
                    break;
                case Status.InvalidSessionID:
                    result = "Invalid SessionID";
                    break;
                default:
                    result = "unknow";
                    break;
            }
            return result;
        }
    }

}